Repository navigation
docs(holoscan-modules): add the pure-Python Module workflow to Create a Module - #19
devin-ai-integration[bot] wants to merge 8 commits into
Conversation
… a Module Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
| │ └── holoscan_my_module/ | ||
| │ └── operators/ | ||
| │ └── my_module_op.py # Typed Input/Output class attributes | ||
| ├── operators/ | ||
| │ └── my_module_op/ | ||
| │ └── metadata.json # Operator metadata only |
There was a problem hiding this comment.
I expected my_module_op.py implementation under the operators/my_module_op folder, not python/holoscan_my_module. Review and consider whether any changes are needed in the CLI template.
There was a problem hiding this comment.
I reviewed this; the CLI template needs changes before the tutorial does.
Why the template uses python/holoscan_my_module/ today: it's the same package directory the cpp python bindings use. scikit-build-core packages it as a single directory (wheel.packages = ["python/holoscan_my_module"]), and operators/<op>/ keeps only metadata.json.
Moving the source to operators/my_module_op/my_module_op.py works. I tried it with scikit-build-core 1.0.3, mapping the directory into the package with the table form:
[tool.scikit-build.wheel.packages]
"holoscan_my_module" = "python/holoscan_my_module"
"holoscan_my_module/operators/my_module_op" = "operators/my_module_op"- The
py3-none-anywheel contained the operator atholoscan_my_module/operators/my_module_op/. pip install -e .picked up edits tooperators/my_module_op/my_module_op.pywithout reinstalling.from holoscan_my_module.operators import MyModuleOpstays the same ifoperators/my_module_op/__init__.pyre-exports the class.
Template work this would need:
- Generate
operators/<op>/{__init__.py, <op>.py}and drop the copy underpython/. - Add one
wheel.packagesentry per operator, pluswheel.excludesometadata.jsonstays out of the wheel. - Make
python/CMakeLists.txtstageoperators/*/into the build tree forholoscan build/run/testandinstall --dev. - Update the operator path that
createprints, and the unit tests and generated docs. - Adding an operator later would also mean adding a
wheel.packagesline.
Recommendation: do it in a holoscan-cli follow-up PR before 5.1.0, so the released template matches the 4.x and C++ layout, where operator source sits next to its metadata.json. I'll update this tutorial's tree and §4.6 afterward. Should I open that CLI PR?
There was a problem hiding this comment.
I opened holoscan-cli#296 as a draft to change the template. Operator source now lives in operators/<op>/<op>.py, with operators/__init__.py exporting every operator. The wheel and build tree install operators/ as holoscan_my_module.operators, and metadata.json stays out of the wheel.
I pushed 6be0057 here so the §3.3 tree and §4.6 match that layout. This PR now depends on #296 as well as the 5.1.0 release.
Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…tors/<op>/ Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…thon Modules Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… operators Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
bhashemian
left a comment
There was a problem hiding this comment.
Two commands need to follow the updated CLI template before this draft is released. Details are inline. Validation was a static comparison against the upstream module templates; no SDK or hardware tests were run.
…omponent, uv group, and namespace Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
[Low impact] The update appears safe to merge once the stated Holoscan CLI release hold is lifted. SummaryAdds the pure-Python Module workflow and wheel packaging guidance to the Create a Module tutorial.
Release hold: Reviews (2) · Last reviewed commit: "docs(holoscan-modules): separate PyPI ad..." · Reviewed by Greptile |
…ings wheels Signed-off-by: Tom Birdsong <tbirdsong@nvidia.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Documents the Module features coming in holoscan-cli 5.1.0 in the "Create a Module" tutorial. The tutorial previously said Python-implemented operators and wheels were unsupported. The features are:
holoscan create --language python(holoscan-cli#284), with its operator layout from holoscan-cli#296;Hold until the next holoscan-cli release. The tutorial pins
holoscan-cli[create]==5.1.0as a placeholder;5.0.0, the current release, has none of these features.New §4.6 Implement operators in pure Python, covering:
hs.Input/hs.Outputoperator inoperators/my_module_op/my_module_op.pyand the graph (forward["in"]);add_holohub_operator()/OP_<name>,cmake.define.OP_<name>, and theTYPE_CHECKINGimport;holoscan build/run/test;OperatorTestHarnesstest;holoscan install --dev --local;pip install --no-build-isolation -Ceditable.rebuild=true -e .);holoscan package ... --pkg-generator WHEEL, which produces apy3-none-anywheel depending onholoscan-core-cu13.Old §4.6–4.11 become §4.7–4.12. The anchors that "Use a Module" links to (§3.2, §4.5) don't change.
§4.9 keeps the Debian package for C++ operators and adds
--pkg-generator WHEELfor Python bindings, which produces acp312-abi3-linux_<arch>wheel.§1 and §2 describe C++ vs. Python operators and the pure-Python host requirements: Python 3.12+, glibc 2.39+, a CUDA 13 driver, and CMake 3.24+. They need no compiler or SDK Debian package.
§3.1 adds a
cpp/cpp python/pythontable, and §3.3 adds the pure-Python tree.The CI, publishing, reference card, and troubleshooting sections are updated, and so are the parent
holoscan-modules/README.mdrequirements. The tutorial goes to0.4.0.Verification
All commands ran in
holoscan:v5.0.0-cuda13with CLI wheels built from holoscan-climainand the #296 branch. There was no GPU, so a stublibcudawas used.pythoncreate,build,run --localmy_module_pipeline received 10 samplespythontest --localpython.my_modulepythoninstall --dev --local, then--uninstallimport holoscan.my_moduleworked, then failed after uninstall, as expectedpythonpackage --pkg-generator WHEEL --localpy3-none-anywheelpythonpytest tests/python, edit an operatorcpp pythonpackage --pkg-generator WHEEL --localcp312-abi3-linux_x86_64wheelcpp pythonpip check,import holoscan.my_module, run the Python pipelinePre-commit passed (lychee and nbcheck skipped), and lychee 0.24.2 run separately passed. Not verified: GPU, aarch64, and host-driven container commands.
Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/e2d0e9d75b0b42f295b43491ae274a9d
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/e2d0e9d75b0b42f295b43491ae274a9d?variant=devin